package cn.nawang.ebeim.client.version;

/**
 * 70. Climbing Stairs My Submissions Question
 * Total Accepted: 95071 Total Submissions: 262789 Difficulty: Easy
 * You are climbing a stair case. It takes n steps to reach to the top.
 * <p>
 * Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
 * <p>
 * Subscribe to see which companies asked this question
 * <p>
 * Created by GanJc on 2016/2/24.
 */
public class ClimbingStairs {

    public static void main(String[] args) {
        System.out.println(climbingStairs(10));
    }

    public static int climbingStairs(int n) {
        int a = 0, b = 1, temp;
        for (int i = 0; i < n; i++) {
            temp = a;
            a = b;
            b = temp + a;
        }
        return b;
    }
}
